

#ifndef UD_DBSPFILT_H
#define UD_DBSPFILT_H

#include "zdbfilter.h"
#include "zgepnt2d.h"
#include "zgevec2d.h"
#include "zgept2dar.h"

#pragma pack (push, 8)

#define UCDB_INFINITE_XCLIP_DEPTH (1.0e+300)

class UcDbExtents;

class UcDbSpatialFilter: public  UcDbFilter
{
public:
    UCDB_DECLARE_MEMBERS(UcDbSpatialFilter);

	     UcDbSpatialFilter();
    virtual ~UcDbSpatialFilter();

    virtual UcRxClass* indexClass() const;

    virtual void queryBounds(UcDbExtents& ext, 
                             const UcDbBlockReference * pRefBlkRef) const;

    UcDbSpatialFilter(const UcGePoint2dArray& pts, 
                      const UcGeVector3d&     normal,
                      double                  elevation,
                      double                  frontClip,
                      double                  backClip,
                      ZSoft::Boolean          enabled);

    void queryBounds(UcDbExtents& ext) const;

    Ucad::ErrorStatus  getVolume(UcGePoint3d&  fromPt, 
                                 UcGePoint3d&  toPt, 
                                 UcGeVector3d& upDir,
                                 UcGeVector2d& viewField) const;

    Ucad::ErrorStatus setDefinition(const UcGePoint2dArray& pts, 
                                    const UcGeVector3d&     normal,
                                    double                  elevation,
                                    double                  frontClip,
                                    double                  backClip,
                                    ZSoft::Boolean          enabled);                                    

   Ucad::ErrorStatus getDefinition(UcGePoint2dArray& pts, 
                                   UcGeVector3d&     normal,
                                   double&           elevation,
                                   double&           frontClip,
                                   double&           backClip,
                                   ZSoft::Boolean&   enabled) const;

    UcGeMatrix3d& getClipSpaceToWCSMatrix(UcGeMatrix3d& mat) const;
    UcGeMatrix3d& getOriginalInverseBlockXform(UcGeMatrix3d& mat) const;
   Ucad::ErrorStatus setPerspectiveCamera(const UcGePoint3d& fromPt);

   ZSoft::Boolean    clipVolumeIntersectsExtents(const UcDbExtents& ext) const;

   ZSoft::Boolean    hasPerspectiveCamera() const;

};

#pragma pack (pop)

#endif 
